//
//  JoinUserTableViewHeaderView.m
//  ECBBusinessCamp
//
//  Created by rimi on 16/6/21.
//  Copyright © 2016年 邓毕华. All rights reserved.
//

#import "JoinUserTableViewHeaderView.h"

#define LABEL_FONTSIZE 24

@interface JoinUserTableViewHeaderView ()

@property (nonatomic, strong) UILabel * nameLabel; // 姓名
@property (nonatomic, strong) UILabel * phoneLabel; // 手机号
@property (nonatomic, strong) UILabel * companyNameLabel; // 公司名称
@property (nonatomic, strong) UILabel * positionLabel; // 职位
@property (nonatomic, strong) UILabel * addressLabel; // 所在地区
@property (nonatomic, strong) UIView * grayView; // 灰色下边线

@end

@implementation JoinUserTableViewHeaderView

#pragma mark 🌷🌷🌷life cycle🌷🌷🌷
- (instancetype)init
{
    self = [super init];
    if (self) {
        // 加载视图
        [self addSubview:self.nameLabel];
        [self addSubview:self.phoneLabel];
        [self addSubview:self.companyNameLabel];
        [self addSubview:self.positionLabel];
        [self addSubview:self.addressLabel];
        [self addSubview:self.grayView];
        
        // 自动布局
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.left.offset(SCREEN_WIDTH * 0.06);
        }];
        [_phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.left.offset(SCREEN_WIDTH * 0.15);
        }];
        [_companyNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.left.offset(SCREEN_WIDTH * 0.35);
        }];
        [_positionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.left.offset(SCREEN_WIDTH * 0.58);
        }];
        [_addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self);
            make.left.offset(SCREEN_WIDTH * 0.78);
        }];
        [_grayView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.sizeOffset(CGSizeMake(SCREEN_WIDTH * 0.9, 1));
            make.centerX.equalTo(self);
            make.bottom.offset(0);
        }];
    }
    return self;
}

#pragma mark 🌷🌷🌷getters and setters🌷🌷🌷
- (UILabel *)nameLabel {
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.text = @"姓名";
        _nameLabel.font = [UIFont systemFontOfSize:LABEL_FONTSIZE];
    }
    return _nameLabel;
}
- (UILabel *)phoneLabel {
    if (!_phoneLabel) {
        _phoneLabel = [[UILabel alloc] init];
        _phoneLabel.text = @"手机号";
        _phoneLabel.font = [UIFont systemFontOfSize:LABEL_FONTSIZE];
    }
    return _phoneLabel;
}
- (UILabel *)companyNameLabel {
    if (!_companyNameLabel) {
        _companyNameLabel = [[UILabel alloc] init];
        _companyNameLabel.text = @"公司名称";
        _companyNameLabel.font = [UIFont systemFontOfSize:LABEL_FONTSIZE];
    }
    return _companyNameLabel;
}
- (UILabel *)positionLabel {
    if (!_positionLabel) {
        _positionLabel = [[UILabel alloc] init];
        _positionLabel.text = @"职位";
        _positionLabel.font = [UIFont systemFontOfSize:LABEL_FONTSIZE];
    }
    return _positionLabel;
}
- (UILabel *)addressLabel {
    if (!_addressLabel) {
        _addressLabel = [[UILabel alloc] init];
        _addressLabel.text = @"所在地区";
        _addressLabel.font = [UIFont systemFontOfSize:LABEL_FONTSIZE];
    }
    return _addressLabel;
}
- (UIView *)grayView {
    if (!_grayView) {
        _grayView = [[UIView alloc] init];
        _grayView.backgroundColor = RGB_COLOR(200, 200, 200, 1);
    }
    return _grayView;
}

@end
